from public.action import *
from public.business import *
from public.testData import *
from public.tools import *
import time
testCase = "DBshop011_添加商品"

dr=openBrowser(urlAdmin) #调用函数打开指定网址,并且获取函数的返回值,函数返回的是浏览器的对象
DBshopLoginAdmin(dr) #调用函数登录dbshop的后台
# 添加商品

dr.find_element_by_link_text("添加商品").click()
time.sleep(1)
dr.find_element_by_link_text("添加商品").click()
name="苹果XR"
jiage="7999"
leixing="虚拟商品"
dr.find_element_by_id("goods_name").send_keys(name)
dr.find_element_by_id("goods_shop_price").send_keys(jiage)
dr.find_element_by_id("goods_type").click()
dr.find_element_by_xpath("//option[text()='%s']"%leixing).click()
dr.find_element_by_xpath("//button/i[@class='icon-ok icon-white']").click()
time.sleep(2)

b=dr.find_element_by_xpath("//tr[2]/td[5]").text
print(b)
if b==jiage:
    writeLog("%s 测试通过" % testCase)
else:
    writeLog("%s 测试通过" % testCase)
    getPhoto(dr)
dr.quit()